/*子页面需要填写的内容：*/
function child(room_id){

	
	$.ajax({
		url:"../../facility/all",
		type:"post",
		dataType:"json",
		data:{
			"room_id":room_id
			
		},
		success:function(data){
			var content = "";
			var student=null;
			for (var i = 0; i < data.length; i++) {
				facility=data[i];
				content +='<tr>'
						+'<td>'+facility.f_name+'</td>'
						+'<td>'+facility.price+'</td>'
						+'<td>';
						if(facility.status==0){
							content	+='<a class="layui-btn layui-btn-xs" onclick="delCustomList(this)">正常</a>';
						}else if(facility.status==1){
							content	+='<a class="layui-btn layui-btn-xs" onclick="delCustomList(this)">损坏</a>';
						}else if(facility.status==2){
							content	+='<a class="layui-btn layui-btn-xs" onclick="delCustomList(this)">维修中</a>';
						}
				
				
				content+='</td>'
						+'<td>'
						+'<a class="layui-btn layui-btn-xs" onclick="delCustomList(this)">删除</a>'
						+'</td>'
						+'</tr>';
						
				
				
				
			}
			
			$("#facility").html(content);
			
			
		}

		
		
		
	});
//该方法相当于入口函数，进入该子页面即执行
}

//删除
function delCustomList(_this){
	layui.use(['form','laydate'], function() {
		layer.confirm('确定要删除么？', {
			btn: ['确定', '取消'] //按钮
		}, function() {
			$(_this).parent().parent().remove();
			layer.msg('删除成功', {
				icon: 1
			});
		}, function() {
			layer.msg('取消删除', {
				time: 2000 //20s后自动关闭
			});
		});
	});
}